//该文件专门创建整个应用的路由器
// import VueRouter from 'vue-router'
import Vue from 'vue'
import Router from 'vue-router'

import layout from '@/layout'
Vue.use(Router)

export const constantRoutes = [
  // 首页
  // {
  //   path: '/login',
  //   component: () => import('../views/login/index.vue')
  // },
  {
    path: '/',
    component: layout,
    // redirect: '/generalInformation',
    meta: {
      title: '企业管理'
    },
    // children: [
    //   {
    //     path: '/generalInformation',
    //     name: 'generalInformation',
    //     component: () => import('../views/company/generalInformation.vue'),
    //     meta: { title: '企业通用信息' }
    //   }
    // ]
  }
]
const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
  })

const router = createRouter()

export function resetRouter () {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
